package Operations;

import Book.Book;
import Book.BookList;

import java.util.Scanner;

public class Findbook implements Ioperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("查找图书");
        System.out.println("请输入你想查找图书的书名");
        Scanner scanner =new Scanner(System.in);
        String name =scanner.nextLine();
        for (int i = 0; i < bookList.getSize() ; i++) {
            Book books= bookList.Getpos(i);
            if(name.equals(books.getBook_name())){
                System.out.println("找到此书");
                System.out.println(books);
                return;
        }
        }
        System.out.println("找不到此书");
    }
}
